Video graphics circuits generate pixel information for objects to be displayed on a computer screen, monitor or television. The source for the object may be television broadcasts, cable television transmissions, satellite television transmissions, computer programs, web pages, and so on. For computer screens, video graphic circuits partition each of the objects to be displayed into triangles. Each triangle is stored as three vertexes and corresponding display parameters for each vertex. The corresponding display parameters include color parameters (red, green, blue), display or pixel locations parameters (x, y, z) and texture parameters (s, t, w).
For corresponding display parameters, a video graphics circuit calculates slopes and associated display parameters for each part within the triangle based on the slopes and corresponding display parameters. The slopes are associated with display parameters and are stored in a triangle descriptor list, which is subsequently used to calculate pixel information.
When a two dimensional object, or one triangle, is to be displayed, there are no unnecessary steps to the process described above. When more than one object is to be displayed and the objects overlap, there are unnecessary steps because pixel information is calculated for each triangle of the object. When all of the pixel information for each object is calculated, a comparison is performed to determine which object is in the foreground. For the object that is in the background with respect to another object, the pixel information for the portion of the object that is overlapped is discarded. Thus, the calculation of such pixel information was unnecessary and adversely affects the efficiency of the video graphics circuit.
If only a small portion of an object is overlapped, the amount of unnecessary pixel information calculations are minimal, there is a minimal adverse affect on the video graphic circuit's efficiency. If, however, the object has a substantially overlapped portion, then the number of unnecessary calculations increases and the efficiency of the video graphics circuit is affected. This may be compounded where several objects have overlapping portions and only one object will be visible in the foreground and be entirely displayed. For example, assume that several faces are to be displayed and they overlap. To begin the display process, the video graphics circuit calculates the slopes and associated display parameters for each triangle of a face, which includes up to 20,000 triangles, and stores the value in the triangle descriptor list and stores the pixel information. The process is repeated for each face to be displayed. Once all of the pixel information is generated, the video graphics circuit compares the components of the faces to determine which one is in the foreground in the overlapped areas.
Another inefficiency arises when a stencil is placed on an output image, whereupon all pixels having a location within the stencil are not visible. A typical stencil display is a shadow based on the position of a light source, wherein pixels that fall within the shadow are not visible and therefore may be unnecessarily rendered. Although, simply because a pixel has a common x,y coordinate, it must further be determined whether the pixel is visible in the z plane, i.e. visible in front of the shadow. Therefore, since the stencil blocks out all pixels at the same x,y address that have a smaller z address than the stencil, i.e. hidden by the shadow, it is inefficient to render the pixels which are not visible by the shadow.
To overcome these inefficiencies, conventional video graphics circuits perform a hierarchical z-buffering technique. Hierarchical z-buffering is performed by comparing multiple pixels having the same x,y location, wherein the z value of a pixel is compared to a stored z value, where the stored z value represents the outermost visible pixel, i.e. having the highest z value. If the pixel to be rendered has a z value that is less than stored z value, the pixel is then rendered because the pixel will be visible. Also, the z value is updated to represent the value of the rendered pixel, as any other pixels at the same location having a smaller z value will be hidden by the rendered pixel.
It is also known for a video graphics circuit to perform a stenciling operation wherein a pixel to be rendered is compared to a stencil and if the pixel will not be visible because it is hidden by the stencil, the pixel will not be rendered. Stenciling operations typically use a stencil mask upon which the pixel is referenced, wherein a determination may be made, based on the x,y,z coordinate of the pixel relative to the stencil mask, whether the rendered pixel will be visible.
Although, conventional video graphics circuits cannot perform both hierarchical z-buffering and stencil operations because the circuit must choose to perform either the hierarchical z-buffering or the stenciling. The hierarchical Z buffering is typically disabled during the stencil test because the stencil test interacts with the Z buffering operation. Therefore, without a means of performing a hierarchical stencil test, it is in general impossible to know the correct result for a hierarchical depth test.
Consequently, there exists a need for a rendering system which efficiently combines hierarchical z-buffering and stenciling operations to a plurality of pixels which are to be rendered.